package com.sanjiahantang.ythshopping.presenter;

import android.content.Context;

import com.sanjiahantang.ythshopping.config.ConfigValue;
import com.sanjiahantang.ythshopping.http.BaseDelegate;
import com.sanjiahantang.ythshopping.http.OkHttpClientManager;
import com.sanjiahantang.ythshopping.model.WebPayModel;
import com.sanjiahantang.ythshopping.views.WebPayView;
import com.squareup.okhttp.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by admin on 2017/8/28.
 */

public class WebPayPresenter extends BasePresenter {
    WebPayView webPayView;

    Context context;

    public WebPayPresenter(Context context, WebPayView webPayView)
    {
        this.context=context;
        this.webPayView=webPayView;
    }

    public void LoadPayMsg(String log_id)
    {
        Map<String,String> params=new HashMap<>();
        params.put("key", ConfigValue.DATA_KEY);
        params.put("log_id",log_id);
        OkHttpClientManager.postAsyn(context, ConfigValue.APP_IP + "scan/getWapPayinfo", params, new BaseDelegate.ResultCallback<WebPayModel>() {
            @Override
            public void onError(Request request, Object tag, Exception e) {

            }

            @Override
            public void onResponse(WebPayModel response, Object tag) {
                webPayView.rePayMsg(response);
            }


        });
    }
}
